package com.spzx.product;

import com.spzx.common.core.constant.Constants;
import com.spzx.common.security.annotation.EnableCustomConfig;
import com.spzx.common.security.annotation.EnableRyFeignClients;
import org.redisson.api.RBloomFilter;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @ClassName SpzxProductApplication
 * @Author 波
 * @Date 2024/7/27 14:22
 */
@SpringBootApplication
@EnableRyFeignClients
@EnableCustomConfig
public class SpzxProductApplication implements CommandLineRunner {
    @Autowired
    private RedissonClient redissonClient;

    public static void main(String[] args) {
        SpringApplication.run(SpzxProductApplication.class, args);
    }

    @Override
    public void run(String... args) throws Exception {
        RBloomFilter<Object> bloomFilter = redissonClient.getBloomFilter(Constants.PRODUCT_BLOOM_FILTER_NAME);
        if (!bloomFilter.isExists()) {
            bloomFilter.tryInit(1000000L, 0.0001);
        }
    }
}
